package com.xsmart.oa.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.common.entity.user.AdminUser;
import com.xsmart.oa.services.AdminLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/api")
public class AdminLoginController {
    @Autowired
    AdminLoginService adminLoginService;


    @RequestMapping(value = "/v1/AdminLoginService/login", method = RequestMethod.POST)
    @ResponseBody
    public Object login(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adminLoginService.login(requestBean);
    }

    @RequestMapping(value = "/v1/AdminLoginService/logout", method = RequestMethod.POST)
    @ResponseBody
    public Object logout(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adminLoginService.logout(requestBean);
    }

    @RequestMapping(value = "/v1/AdminLoginService/loginCheck", method = RequestMethod.POST)
    @ResponseBody
    public Object loginCheck(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adminLoginService.checkLogin(requestBean);
    }
}
